spb/llmindex Public
The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.
TypeScript 77.9%
TeX 15.2%
Python 3.7%
SQL 1.4%
JavaScript 1.1%
Shell 0.5%
1/**2 * llmindex.io — GET /api/v1/models/:slug (full model profile; slug contains "/")3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import { type NextRequest } from 'next/server';8import { getModelProfile } from '@/lib/data';9import { apiError, apiJson } from '@/lib/api';10import { rateLimit } from '@/lib/rate-limit';1112export const dynamic = 'force-dynamic';1314export async function GET(req: NextRequest, { params }: { params: { slug: string[] } }) {15 const limited = await rateLimit(req);16 if (limited) return limited;17 const slug = params.slug.join('/');18 const profile = await getModelProfile(slug);19 if (!profile) return apiError(404, 'model_not_found_or_not_scored');20 return apiJson(21 {22 index_version: profile.run.indexVersion,23 model: {24 slug: profile.slug,25 name: profile.name,26 provider: profile.provider,27 context_length: profile.contextLength,28 prompt_price_per_1m_usd: profile.promptPricePerM,29 completion_price_per_1m_usd: profile.completionPricePerM,30 },31 run: {32 id: profile.run.id,33 kind: profile.run.kind,34 status: profile.run.status,35 created_at: profile.run.createdAt,36 notes: profile.run.notes,37 },38 global: profile.global39 ? {40 score: profile.global.score,41 score_low: profile.global.scoreLow,42 score_high: profile.global.scoreHigh,43 }44 : null,45 domains: profile.domains.map((d) => ({46 domain: d.domain,47 score: d.score,48 score_low: d.scoreLow,49 score_high: d.scoreHigh,50 sub_metrics: d.subMetrics,51 })),52 run_history: profile.runHistory.map((h) => ({53 run_id: h.runId,54 index_version: h.indexVersion,55 kind: h.kind,56 created_at: h.createdAt,57 score: h.score,58 })),59 },60 { cacheSeconds: 3600 },61 );62}63